﻿using System;
using System.Linq;
using DZLib.ExtendFramework.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DZLib.ExtendFramework.UnitTests.Generic.ExtendIEnumerableTest
{
    [TestClass]
    public class ExpandTest
    {
        [TestMethod]
        public void ExpandNormTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0 };
            var actual = testCase.Expand(12);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }

        [TestMethod]
        public void ExpandLowBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6 };
            var actual = testCase.Expand(3);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }

        [TestMethod]
        public void ExpandUpperBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6 };
            var actual = testCase.Expand(6);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }

        [TestMethod]
        public void ExpandInitTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7 };
            var actual = testCase.Expand(12, 7);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }

        [TestMethod]
        public void ExpandInitLowBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6 };
            var actual = testCase.Expand(3, 0);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }

        [TestMethod]
        public void ExpandInitUpperBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6 };
            var expected = new int[] { 1, 2, 3, 4, 5, 6 };
            var actual = testCase.Expand(6, 9);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
    }
}
